import request from '@/utils/request'

const api = {
  userQuery: '/sys/user/query',
  roleQuery: '/sys/role/query',
  bannerQuery: '/operation/banner/query',
  repaymentPlanQuery: '/repaymentPlan/query',
  addRole: '/sys/role/add',
  updateRole: '/sys/role/modify',
  roleDtl: '/sys/role/detail',
  delRole: '/sys/role/remove',
  editRoleStatus: '/sys/role/modify/status',
  addUser: '/sys/user/add',
  updateUser: '/sys/user/modify',
  userDtl: '/sys/user/detail',
  delUser: '/sys/user/remove',
  editUserStatus: '/sys/user/modify/status',
  resetPassword: '/sys/user/restPassword',
  addBanner: '/operation/banner/add',
  updateBanner: '/operation/banner/modify',
  editBannerStatus: '/operation/banner/modify/status',
  bannerDtl: '/operation/banner/detail',
  editBannerSeq: '/operation/banner/modify/seq',
  delBanner: '/operation/banner/remove',
  addRepaymentPlan: '/repaymentPlan/add',
  updateRepaymentPlan: '/repaymentPlan/modify',
  editRepaymentPlanStatus: '/repaymentPlan/modify/status',
  delRepaymentPlan: '/repaymentPlan/remove'
}

/**
 * userQuery func
 * parameter: {
 *     pageNum: '',
 *     pageSize: '',
 *     userName: '',
 *     userPhone: '',
 *     status：'',
 *     startTime:'',
 *     endTime:''
 * }
 * @param parameter
 * @returns {*}
 */
export function getUserList (parameter) {
  return request({
    url: api.userQuery,
    method: 'post',
    data: parameter
  })
}

/**
 * roleQuery func
 * parameter: {
 *     pageNum: '',
 *     pageSize: '',
 *     roleName: '',
 *     status：''
 * }
 * @param parameter
 * @returns {*}
 */
export function getRoleList (parameter) {
  return request({
    url: api.roleQuery,
    method: 'post',
    data: parameter
  })
}

/**
 * roleQuery func
 * parameter: {
 *     pageNum: '',
 *     pageSize: '',
 *     roleName: '',
 *     status：''
 * }
 * @param parameter
 * @returns {*}
 */
export function getBannerList (parameter) {
  return request({
    url: api.bannerQuery,
    method: 'post',
    data: parameter
  })
}

/**
 * repaymentPlan func
 * parameter: {
 *     pageNum: '',
 *     pageSize: '',
 *     status：''
 * }
 * @param parameter
 * @returns {*}
 */
export function getRepaymentPlanList (parameter) {
  return request({
    url: api.repaymentPlanQuery,
    method: 'post',
    data: parameter
  })
}

/**
 * addRole func
 * parameter: {
 *     roleName: '',
 *     status：'',
 *     description:'',
 *     permissionList:[{permissionId:''}]
 * }
 * @param parameter
 * @returns {*}
 */
export function addRole (parameter) {
  return request({
    url: api.addRole,
    method: 'post',
    data: parameter
  })
}

/**
 * updateRole func
 * parameter: {
 *     roleId:'',
 *     roleName: '',
 *     status：'',
 *     description:'',
 *     permissionList:[{permissionId:''}]
 * }
 * @param parameter
 * @returns {*}
 */
export function updateRole (parameter) {
  return request({
    url: api.updateRole,
    method: 'post',
    data: parameter
  })
}

/**
* roleDtl func
* parameter: {
*     roleId: '',
* }
* @param parameter
* @returns {*}
*/
export function getRoleDtl (parameter) {
  return request({
    url: api.roleDtl,
    method: 'post',
    data: parameter
  })
}

/**
* delRole func
* parameter: {
*     roleId: '',
* }
* @param parameter
* @returns {*}
*/
export function delRole (parameter) {
  return request({
    url: api.delRole,
    method: 'post',
    data: parameter
  })
}

/**
* editRoleStatus func
* parameter: {
*    status:'',
*    roleList:[ roleId: '']
* }
* @param parameter
* @returns {*}
*/
export function editRoleStatus (parameter) {
  return request({
    url: api.editRoleStatus,
    method: 'post',
    data: parameter
  })
}

/**
 * addUser func
 * parameter: {
 *     userName: '',
 *     userPhone:'',
 *     userPassword:'',
 *     roleId:'',
 *     department:'',
 *     userPost:'',
 *     status：'',
 *     userEmail:''
 * }
 * @param parameter
 * @returns {*}
 */
export function addUser (parameter) {
  return request({
    url: api.addUser,
    method: 'post',
    data: parameter
  })
}

/**
 * updateUser func
 * parameter: {
 *     userId:'',
 *     userName: '',
 *     userPhone:'',
 *     userPassword:'',
 *     roleId:'',
 *     department:'',
 *     userPost:'',
 *     status：'',
 *     userEmail:''
 * }
 * @param parameter
 * @returns {*}
 */
export function updateUser (parameter) {
  return request({
    url: api.updateUser,
    method: 'post',
    data: parameter
  })
}

/**
* userDtl func
* parameter: {
*     userId: '',
* }
* @param parameter
* @returns {*}
*/
export function getUserDtl (parameter) {
  return request({
    url: api.userDtl,
    method: 'post',
    data: parameter
  })
}

/**
* delUser func
* parameter: {
*     userId: '',
* }
* @param parameter
* @returns {*}
*/
export function delUser (parameter) {
  return request({
    url: api.delUser,
    method: 'post',
    data: parameter
  })
}

/**
* editUserStatus func
* parameter: {
*    status:'',
*    userList:[ userId: '']
* }
* @param parameter
* @returns {*}
*/
export function editUserStatus (parameter) {
  return request({
    url: api.editUserStatus,
    method: 'post',
    data: parameter
  })
}

/**
* restPassword func
* parameter: {
*    userId:'',
*    userPassword:''
* }
* @param parameter
* @returns {*}
*/
export function resetPassword (parameter) {
  return request({
    url: api.resetPassword,
    method: 'post',
    data: parameter
  })
}

/**
 * addBanner func
 * parameter: {
 *     bannerName: '',
 *     clientType:'',
 *     bannerType:'',
 *     bannerPicture:'',
 *     targetObj:'',
 *     expiryStartTime:'',
 *     expiryEndTime:'',
 *     status：'',
 *     seq:''
 * }
 * @param parameter
 * @returns {*}
 */
export function addBanner (parameter) {
  return request({
    url: api.addBanner,
    method: 'post',
    data: parameter
  })
}

/**
 * updateBanner func
 * parameter: {
 *     bannerId:'',
 *     bannerName: '',
 *     clientType:'',
 *     bannerType:'',
 *     bannerPicture:'',
 *     targetObj:'',
 *     expiryStartTime:'',
 *     expiryEndTime:'',
 *     status：'',
 *     seq:''
 * }
 * @param parameter
 * @returns {*}
 */
export function updateBanner (parameter) {
  return request({
    url: api.updateBanner,
    method: 'post',
    data: parameter
  })
}

/**
* bannerDtl func
* parameter: {
*     bannerId: '',
* }
* @param parameter
* @returns {*}
*/
export function getBannerDtl (parameter) {
  return request({
    url: api.bannerDtl,
    method: 'post',
    data: parameter
  })
}

/**
* delBanner func
* parameter: {
*     bannerId: '',
* }
* @param parameter
* @returns {*}
*/
export function delBanner (parameter) {
  return request({
    url: api.delBanner,
    method: 'post',
    data: parameter
  })
}

/**
* editBannerStatus func
* parameter: {
*    status:'',
*    bannerList:[ bannerId: '']
* }
* @param parameter
* @returns {*}
*/
export function editBannerStatus (parameter) {
  return request({
    url: api.editBannerStatus,
    method: 'post',
    data: parameter
  })
}

/**
 * addRepaymentPlan func
 * parameter: {
 *     repaymentPlanName:'',
 *     status：'',
 *     expiryStartTime:'',
 *     expiryEndTime:''
 * }
 * @param parameter
 * @returns {*}
 */
export function addRepaymentPlan (parameter) {
  return request({
    url: api.addRepaymentPlan,
    method: 'post',
    data: parameter
  })
}

/**
 * updateRepaymentPlan func
 * parameter: {
 *     repaymentPlanId:'',
 *     repaymentPlanName:'',
 *     status：'',
 *     expiryStartTime:'',
 *     expiryEndTime:''
 * }
 * @param parameter
 * @returns {*}
 */
export function updateRepaymentPlan (parameter) {
  return request({
    url: api.updateRepaymentPlan,
    method: 'post',
    data: parameter
  })
}

/**
* delRepaymentPlan func
* parameter: {
*     repaymentPlanId: '',
* }
* @param parameter
* @returns {*}
*/
export function delRepaymentPlan (parameter) {
  return request({
    url: api.delRepaymentPlan,
    method: 'post',
    data: parameter
  })
}

/**
* editRepaymentPlanStatus func
* parameter: {
*    status:'',
*    repaymentPlanId:'',
     freezingReason:''
* }
* @param parameter
* @returns {*}
*/
export function editRepaymentPlanStatus (parameter) {
  return request({
    url: api.editRepaymentPlanStatus,
    method: 'post',
    data: parameter
  })
}
